<?php
// 允许跨域资源访问：CORS
	header("Access-Control-Allow-Origin:*");
	// 从 POST 请求中获取登录的用户名与密码
	$iphone = $_POST["iphone"];
	$username = $_POST["username"];
	$password = $_POST["password"];
	
	$conn = mysqli_connect("localhost","root","root","h51806");
	
	$sql = "INSERT INTO users (iphone,username,password) VALUES ('$iphone','$username','$password')";
	
	$result = mysqli_query($conn,$sql);
	
	if ($result) {
		$arr = array("res_code" => 1,"res_massage"=>"success");
		echo json_encode($arr);
	} else { // 用户名或密码错误
		$arr = array("res_code"=>-1, "res_message"=>"error:". mysqli_error($conn));
		echo json_encode($arr);
	}
	// 关闭
	mysqli_close($conn);
?>